
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Go 语言简介 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../part2/" />
    
    
    <link rel="prev" href="../" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    Go 语言简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../part2/">
            
                <a href="../part2/">
            
                    
                    Go 语言环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../part3/">
            
                <a href="../part3/">
            
                    
                    Go 语言结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../part4/">
            
                <a href="../part4/">
            
                    
                    Go 语言基础语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../part5/">
            
                <a href="../part5/">
            
                    
                    Go 语言数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../part6/">
            
                <a href="../part6/">
            
                    
                    Go 语言变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../part7/">
            
                <a href="../part7/">
            
                    
                    Go 语言常量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../part8/">
            
                <a href="../part8/">
            
                    
                    Go 语言运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../part9/">
            
                <a href="../part9/">
            
                    
                    Go 语言条件语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../part10/">
            
                <a href="../part10/">
            
                    
                    Go 语言循环语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../part11/">
            
                <a href="../part11/">
            
                    
                    Go 语言函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../part12/">
            
                <a href="../part12/">
            
                    
                    Go 语言数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../part13/">
            
                <a href="../part13/">
            
                    
                    Go 语言指针
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../part14/">
            
                <a href="../part14/">
            
                    
                    Go 语言结构体
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../part15/">
            
                <a href="../part15/">
            
                    
                    Go 语言切片(Slice)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../part16/">
            
                <a href="../part16/">
            
                    
                    Go 语言范围(Range)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../part17/">
            
                <a href="../part17/">
            
                    
                    Go 语言Map(集合)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="../part18/">
            
                <a href="../part18/">
            
                    
                    Go 语言递归函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="../part19/">
            
                <a href="../part19/">
            
                    
                    Go 语言类型转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="../part20/">
            
                <a href="../part20/">
            
                    
                    Go 语言接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.22" data-path="../part21/">
            
                <a href="../part21/">
            
                    
                    Go 错误处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23" data-path="../part22/">
            
                <a href="../part22/">
            
                    
                    Go 并发
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Go 语言简介</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="go&#x8BED;&#x8A00;&#x7B80;&#x4ECB;">Go&#x8BED;&#x8A00;&#x7B80;&#x4ECB;</h1>
<p style="text-indent:2em">
Go &#x662F;&#x4E00;&#x4E2A;&#x5F00;&#x6E90;&#x7684;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#xFF0C;&#x5B83;&#x80FD;&#x8BA9;&#x6784;&#x9020;&#x7B80;&#x5355;&#x3001;&#x53EF;&#x9760;&#x4E14;&#x9AD8;&#x6548;&#x7684;&#x8F6F;&#x4EF6;&#x53D8;&#x5F97;&#x5BB9;&#x6613;&#x3002;
</p>
<p style="text-indent:2em">
Go&#x662F;&#x4ECE;2007&#x5E74;&#x672B;&#x7531;Robert Griesemer, Rob Pike, Ken Thompson&#x4E3B;&#x6301;&#x5F00;&#x53D1;&#xFF0C;&#x540E;&#x6765;&#x8FD8;&#x52A0;&#x5165;&#x4E86;Ian Lance Taylor, Russ Cox&#x7B49;&#x4EBA;&#xFF0C;&#x5E76;&#x6700;&#x7EC8;&#x4E8E;2009&#x5E74;11&#x6708;&#x5F00;&#x6E90;&#xFF0C;&#x5728;2012&#x5E74;&#x65E9;&#x4E9B;&#x65F6;&#x5019;&#x53D1;&#x5E03;&#x4E86;Go 1&#x7A33;&#x5B9A;&#x7248;&#x672C;&#x3002;&#x73B0;&#x5728;Go&#x7684;&#x5F00;&#x53D1;&#x5DF2;&#x7ECF;&#x662F;&#x5B8C;&#x5168;&#x5F00;&#x653E;&#x7684;&#xFF0C;&#x5E76;&#x4E14;&#x62E5;&#x6709;&#x4E00;&#x4E2A;&#x6D3B;&#x8DC3;&#x7684;&#x793E;&#x533A;&#x3002;
</p>

<h1 id="go-&#x8BED;&#x8A00;&#x7279;&#x8272;">Go &#x8BED;&#x8A00;&#x7279;&#x8272;</h1>
<ul>
<li>&#x7B80;&#x6D01;&#x3001;&#x5FEB;&#x901F;&#x3001;&#x5B89;&#x5168;</li>
<li>&#x5E76;&#x884C;&#x3001;&#x6709;&#x8DA3;&#x3001;&#x5F00;&#x6E90;</li>
<li>&#x5185;&#x5B58;&#x7BA1;&#x7406;&#x3001;&#x6570;&#x7EC4;&#x5B89;&#x5168;&#x3001;&#x7F16;&#x8BD1;&#x8FC5;&#x901F;</li>
</ul>
<h1 id="go-&#x8BED;&#x8A00;&#x7528;&#x9014;">Go &#x8BED;&#x8A00;&#x7528;&#x9014;</h1>
<p style="text-indent:2em">
Go &#x8BED;&#x8A00;&#x88AB;&#x8BBE;&#x8BA1;&#x6210;&#x4E00;&#x95E8;&#x5E94;&#x7528;&#x4E8E;&#x642D;&#x8F7D; Web &#x670D;&#x52A1;&#x5668;&#xFF0C;&#x5B58;&#x50A8;&#x96C6;&#x7FA4;&#x6216;&#x7C7B;&#x4F3C;&#x7528;&#x9014;&#x7684;&#x5DE8;&#x578B;&#x4E2D;&#x592E;&#x670D;&#x52A1;&#x5668;&#x7684;&#x7CFB;&#x7EDF;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x3002;
</p>

<p style="text-indent:2em">
&#x5BF9;&#x4E8E;&#x9AD8;&#x6027;&#x80FD;&#x5206;&#x5E03;&#x5F0F;&#x7CFB;&#x7EDF;&#x9886;&#x57DF;&#x800C;&#x8A00;&#xFF0C;Go &#x8BED;&#x8A00;&#x65E0;&#x7591;&#x6BD4;&#x5927;&#x591A;&#x6570;&#x5176;&#x5B83;&#x8BED;&#x8A00;&#x6709;&#x7740;&#x66F4;&#x9AD8;&#x7684;&#x5F00;&#x53D1;&#x6548;&#x7387;&#x3002;&#x5B83;&#x63D0;&#x4F9B;&#x4E86;&#x6D77;&#x91CF;&#x5E76;&#x884C;&#x7684;&#x652F;&#x6301;&#xFF0C;&#x8FD9;&#x5BF9;&#x4E8E;&#x6E38;&#x620F;&#x670D;&#x52A1;&#x7AEF;&#x7684;&#x5F00;&#x53D1;&#x800C;&#x8A00;&#x662F;&#x518D;&#x597D;&#x4E0D;&#x8FC7;&#x4E86;&#x3002;
</p>

<h1 id="&#x7B2C;&#x4E00;&#x4E2A;-go-&#x7A0B;&#x5E8F;">&#x7B2C;&#x4E00;&#x4E2A; Go &#x7A0B;&#x5E8F;</h1>
<p style="text-indent:2em">
&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x6765;&#x7F16;&#x5199;&#x7B2C;&#x4E00;&#x4E2A; Go &#x7A0B;&#x5E8F; hello.go&#xFF08;Go &#x8BED;&#x8A00;&#x6E90;&#x6587;&#x4EF6;&#x7684;&#x6269;&#x5C55;&#x662F; .go&#xFF09;&#xFF0C;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;
</p>

<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">&quot;fmt&quot;</span>

<span class="hljs-keyword">func</span> main() {
    fmt.Println(<span class="hljs-string">&quot;Hello, World!&quot;</span>)
}
</code></pre>
<p>&#x8981;&#x6267;&#x884C; Go &#x8BED;&#x8A00;&#x4EE3;&#x7801;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>go run</code> &#x547D;&#x4EE4;&#x3002;</p>
<p>&#x6267;&#x884C;&#x4EE5;&#x4E0A;&#x4EE3;&#x7801;&#x8F93;&#x51FA;:</p>
<pre><code class="lang-sh">$ go run hello.go 
Hello, World!
</code></pre>
<p>&#x6B64;&#x5916;&#x6211;&#x4EEC;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; go build &#x547D;&#x4EE4;&#x6765;&#x751F;&#x6210;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code class="lang-sh">$ go build hello.go 
$ ls
hello    hello.go
$ ./hello 
Hello, World!
</code></pre>
<hr>
<h2 id="ps">PS</h2>
<p style="text-indent:2em">
&#x8BA1;&#x7B97;&#x673A;&#x8F6F;&#x4EF6;&#x7ECF;&#x5386;&#x4E86;&#x6570;&#x5341;&#x5E74;&#x7684;&#x53D1;&#x5C55;&#xFF0C;&#x5F62;&#x6210;&#x4E86;&#x591A;&#x79CD;&#x5B66;&#x672F;&#x6D41;&#x6D3E;&#xFF0C;&#x6709;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x7F16;&#x7A0B;&#x3001;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7F16;&#x7A0B;&#x3001;&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;&#x3001;&#x9762;&#x5411;&#x6D88;&#x606F;&#x7F16;&#x7A0B;&#x7B49;&#xFF0C;&#x8FD9;&#x4E9B;&#x601D;&#x60F3;&#x7A76;&#x7ADF;&#x5B70;&#x4F18;&#x5B70;&#x52A3;&#xFF0C;&#x4F17;&#x8BF4;&#x7EB7;&#x7EAD;&#x3002;
</p>

<p style="text-indent:2em">
&#x9664;&#x4E86;OOP&#x5916;&#xFF0C;&#x8FD1;&#x5E74;&#x51FA;&#x73B0;&#x4E86;&#x4E00;&#x4E9B;&#x5C0F;&#x4F17;&#x7684;&#x7F16;&#x7A0B;&#x54F2;&#x5B66;&#xFF0C;Go&#x8BED;&#x8A00;&#x5BF9;&#x8FD9;&#x4E9B;&#x601D;&#x60F3;&#x4EA6;&#x6709;&#x6240;&#x5438;&#x6536;&#x3002;&#x4F8B;&#x5982;&#xFF0C;Go&#x8BED;&#x8A00;&#x63A5;&#x53D7;&#x4E86;&#x51FD;&#x6570;&#x5F0F;&#x7F16;&#x7A0B;&#x7684;&#x4E00;&#x4E9B;&#x60F3;&#x6CD5;&#xFF0C;&#x652F;&#x6301;&#x533F;&#x540D;&#x51FD;&#x6570;&#x4E0E;&#x95ED;&#x5305;&#x3002;&#x518D;&#x5982;&#xFF0C;Go&#x8BED;&#x8A00;&#x63A5;&#x53D7;&#x4E86;&#x4EE5;Erlang&#x8BED;&#x8A00;&#x4E3A;&#x4EE3;&#x8868;&#x7684;&#x9762;&#x5411;&#x6D88;&#x606F;&#x7F16;&#x7A0B;&#x601D;&#x60F3;&#xFF0C;&#x652F;&#x6301;goroutine&#x548C;&#x901A;&#x9053;&#xFF0C;&#x5E76;&#x63A8;&#x8350;&#x4F7F;&#x7528;&#x6D88;&#x606F;&#x800C;&#x4E0D;&#x662F;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#x6765;&#x8FDB;&#x884C;&#x5E76;&#x53D1;&#x7F16;&#x7A0B;&#x3002;&#x603B;&#x4F53;&#x6765;&#x8BF4;&#xFF0C;Go&#x8BED;&#x8A00;&#x662F;&#x4E00;&#x4E2A;&#x975E;&#x5E38;&#x73B0;&#x4EE3;&#x5316;&#x7684;&#x8BED;&#x8A00;&#xFF0C;&#x7CBE;&#x5C0F;&#x4F46;&#x975E;&#x5E38;&#x5F3A;&#x5927;&#x3002;
</p>

<p>Go &#x8BED;&#x8A00;&#x6700;&#x4E3B;&#x8981;&#x7684;&#x7279;&#x6027;&#xFF1A;</p>
<ul>
<li>&#x81EA;&#x52A8;&#x5783;&#x573E;&#x56DE;&#x6536;</li>
<li>&#x66F4;&#x4E30;&#x5BCC;&#x7684;&#x5185;&#x7F6E;&#x7C7B;&#x578B;</li>
<li>&#x51FD;&#x6570;&#x591A;&#x8FD4;&#x56DE;&#x503C;</li>
<li>&#x9519;&#x8BEF;&#x5904;&#x7406;</li>
<li>&#x533F;&#x540D;&#x51FD;&#x6570;&#x548C;&#x95ED;&#x5305;</li>
<li>&#x7C7B;&#x578B;&#x548C;&#x63A5;&#x53E3;</li>
<li>&#x5E76;&#x53D1;&#x7F16;&#x7A0B;</li>
<li>&#x53CD;&#x5C04;</li>
<li>&#x8BED;&#x8A00;&#x4EA4;&#x4E92;&#x6027;</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../" class="navigation navigation-prev " aria-label="Previous page: Introduction">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../part2/" class="navigation navigation-next " aria-label="Next page: Go 语言环境安装">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Go 语言简介","level":"1.2","depth":1,"next":{"title":"Go 语言环境安装","level":"1.3","depth":1,"path":"part2/README.md","ref":"part2/README.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"part1/README.md","mtime":"2021-01-18T02:26:45.805Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-01-21T06:29:04.898Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

